<html>
<head>
<title>猩猩电竞</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta itemprop="name" content="猩猩电竞">
<meta name="description" itemprop="description" content="猩球大战杯—自定义模式娱乐赛，开赛啦！位置有限，速来报名！"/>
<meta property="og:title" content="猩猩电竞" />
<meta property="og:description" content="猩球大战杯—自定义模式娱乐赛，开赛啦！位置有限，速来报名！" />
<meta property="og:image" content="http://share.axingxing.com/allstar/images/logo.jpg" />

<link rel="icon" href="http://share.axingxing.com/allstar/images/logo.jpg" type="image/vnd.microsoft.icon"/>
<style type="text/css">
[title="站长统计"]{
  display: none;
}
body{
  position: relative;
  /*overflow: auto;*/
}
html.dialog-open{
  overflow: hidden;
}
body.dialog-open{
  overflow: hidden;
  position: absolute;
  /*background: rgba(0, 0, 0, .6);*/
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}
.clearfix:after{
  display: block;
  content: ' ';
  clear: both;
  height: 0;
  font-size: 0;
  overflow: hidden;
}
.apply-btn{
  position: absolute;
  top: 10.1rem;
  left: 50%;
  width: 4.95rem;
  height: 1.2rem;
  margin-left: -2.48rem;
  /*transform: translate(-50%, 0);*/

  /*background: rgba(0, 0, 0, 0.5);*/
}

.tip{
  display: none;
  position: fixed;
  background: rgba(0, 0, 0, .6);
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
}
.tip .tip-content{
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6.98rem;
  height: 4.43rem;
  /*-webkit-transform: translate(-50%, -50%);*/
  /*transform: translate(-50%, -50%);*/
  margin-left: -3.49rem;
  margin-top: -2.22rem;
}
.tip .tip-bg{
  width: 100%;
  position: absolute;
  z-index: -1;
}
.tip .tip-content .tip-text{
  padding-top: 1rem;
  text-align: center;
  font-size:0.26rem;
  color:rgba(255,255,255,1);
}

.apply-dialog{
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  background: rgba(0, 0, 0, .6);
}
.apply-dialog .apply-dialog-content{
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6.98rem;
  height: 6.26rem;
  /*transform: translate(-50%, -60%);*/
  margin-left: -3.49rem;
  margin-top: -3.13rem;
}

.apply-dialog .apply-dialog-content .close{
  position: absolute;
  top: 0.15rem;
  right: 0.25rem;
  width: 0.5rem;
  height: 0.5rem;

}

.apply-dialog .apply-dialog-bg{
  width: 100%;
  position: absolute;
  z-index: -1;
}
.form-group{
  margin-top: 0.1rem;
  height:0.5rem;

}
.form-group.first-child{
  margin-top: 1.17rem;
}
.form-group:after{
  display: block;
  content: ' ';
  clear: both;
  height: 0;
  font-size: 0;
  overflow: hidden;
}
.form-group .form-label{
  float: left;
  width:2.45rem;
  height:0.5rem;
  font-size:0.26rem;
  color:rgba(255,255,255,1);
  text-align: right;
}

.form-group .form-control-wrap{
  float: left;
  /*margin-top: 0.2rem;*/
  width: 4rem;
}

.form-group .form-control{
  padding-left: .06rem;
  height:0.5rem; 
  line-height:0.5rem; 
  width: 100%;
  background:rgba(26,158,231,1);
  border-radius: 0.05rem ; 
  border: 0.01rem solid RGBA(255, 255, 255, 1);
  color: #ffde4c;
}

.form-group .form-control[disabled]{
  color: #ffde4c;
}


.checkbox{
  float: left;
  position: relative;
  padding-left: .36rem;
  font-size: 0.26rem;
  color:rgba(255,255,255,1);
}
.checkbox.checked:before{
  background: url(./images/16_checked.png);
  background-size: contain;
}
.checkbox:before{
  display: block;
  content: ' ';
  position: absolute;
  left: 0;
  top: 0;
  width: 0.34rem;
  height: 0.34rem;
  background: url(./images/16_check.png);
  background-size: contain;
}

.save-btn{
  display: block;
  margin-top: .3rem;
  width:2.2rem;
  height:0.6rem;
  line-height:0.6rem;
  background:rgba(255,222,76,1);
  border-radius: 0.1rem ;
  text-align: center;
  font-size:0.3rem;
  color:rgba(63,51,0,1);
  box-shadow: 2px 2px 2px RGBA(255, 149, 31, 1);
}

.prize{
  display: none;
}
.rule{
  display: none;
}
.rank{
  display: none;
}
.time-btn{
  position: absolute;
  top: 13.35rem;
  left: 0.3rem;
  width: 1.76rem;
  height: .8rem;
}
.rule-btn{
  position: absolute;
  top: 13.35rem;
  left: 2.06rem;
  width: 1.75rem;
  height: .8rem;
}
.prize-btn{
  position: absolute;
  top: 13.35rem;
  left: 3.75rem;
  width: 1.75rem;
  height: .8rem;
}
.rank-btn{
  position: absolute;
  top: 13.35rem;
  left: 5.46rem;
  width: 1.8rem;
  height: .8rem;
}
a{
  text-decoration: none;
}
.footer-wrap {
  display: none;
  width: 100%;
  height: 0.92rem;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
}

.open-btn {
  position: absolute;
  top: 50%;
  right: 0.2rem;
  margin-top: -0.3rem;
  border-radius: 0.1rem;
  width: 1.84rem;
  height: 0.6rem;
  line-height: 0.6rem;
  font-size: 0.28rem;
  text-align: center;
  color: #fff;
  background-color: #ffbb22;
}

table{
  margin-bottom: 0rem;
}

.footer {
  z-index: 10000;
  padding: 0 0 0 .3rem;
  box-sizing: border-box;
  height: .92rem;
  width: 100%;
  background: #000;
  overflow: hidden;
  line-height: .92rem;
  color: #fff;
  font-size: .28rem;
}
.footer .logo {
    display: inline-block;
    position: relative;
    top: 0.18rem;
    width: 0.64rem;
    height: 0.64rem;
}
/*.footer .qianwang {
  text-align: center;
  width: 2.14rem;
  height: 100%;
  background: #181927;
}*/
</style>
</head>
<body bgcolor="#181927" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<script type="text/javascript">
(function (doc, win) {  //rem布局
    var docElem = doc.documentElement;
  var resizeEvent = 'onorientationchange' in win ? 'orientationchange' : 'resize';
  recalc();
// alert(resizeEvent)
  function recalc() {
    setViewport(1);
    var clientWidth = docElem.clientWidth;
    if (!clientWidth) return;
    // var dpr = win.devicePixelRatio || 1;
    var dpr = 1;
    var fontSize = 100 * (clientWidth / 750) * dpr + 'px';
    var scale = 1 / dpr;
    // alert(scale + ':' + fontSize)
    docElem.style.fontSize = fontSize;
    setViewport(scale);
  };

  function setViewport(scale){
    var viewportElem = doc.querySelector('meta[name="viewport"]');
    if(!viewportElem){
      viewportElem = doc.createElement('meta');
      doc.head.appendChild(viewportElem);
    }
    viewportElem.setAttribute('name', 'viewport');
    viewportElem.setAttribute('content', 'width=device-width, user-scalable=no, initial-scale=' + scale + ', maximum-scale=' + scale + ', minimum-scale=' + scale);
  }

  if (!doc.addEventListener) return;
  win.addEventListener(resizeEvent, function(){
    setTimeout(function(){
    }, 1000);
    if('orientation' in window){
      setTimeout(function(){
        recalc();
      }, 150);
    }else{
      recalc();
    }

  }, false);
  doc.addEventListener('DOMContentLoaded', function(){
    recalc();
    setTimeout(function(){//解决小米  oppo 等部分手机适配问题
      recalc();
    }, 50);
  }, false);

})(document, window);
</script>

<div style="display: none;">
    <img src="http://share.axingxing.com/allstar/images/logo.jpg">
</div>
<a href="javascript:;" class="apply-btn"></a>
<a href="javascript:;" class="time-btn"></a>
<a href="javascript:;" class="rule-btn"></a>
<a href="javascript:;" class="prize-btn"></a>
<a href="javascript:;" class="rank-btn"></a>     
<div class="tip">
  <div class="tip-content">
     <img src="images/16_tip.png" alt="" class="tip-bg">
     <div class="tip-text"></div>
  </div>
</div>

<div class="apply-dialog">
  <div class="apply-dialog-content">
     <img src="images/16_apply_dialog_bg.png" alt="" class="apply-dialog-bg">
     <div class="close"></div>
     <div class="form-group first-child">
       <div class="form-label">猩猩电竞昵称： </div>
       <div class="form-control-wrap">
         <input id="nick_name" type="text" name="" class="form-control" disabled>
       </div>
     </div>
     <div class="form-group">
       <div class="form-label">UID： </div>
       <div class="form-control-wrap">
         <input id="uid" type="text" name="" class="form-control" disabled>
       </div>
     </div>
     <div class="form-group">
       <div class="form-label">游戏ID： </div>
       <div class="form-control-wrap">
         <input id="steamid" type="text" name="" class="form-control">
       </div>
     </div>
     <div class="form-group">
       <div class="form-label">报名场次： </div>
       <div id="changci-box" class="form-control-wrap">
          <!-- <span class="checkbox first" data-id="0">第一场</span>
         <span class="checkbox second" data-id="1">第二场</span>
         <span class="checkbox third" data-id="2">第三场</span> -->
       </div>
     </div>
     <div class="form-group">
       <div class="form-label">QQ： </div>
       <div class="form-control-wrap">
         <input id="weixin_qq" type="text" name="" class="form-control">
       </div>
     </div>
     <div class="form-group">
       <div class="form-label">电话：</div>
       <div class="form-control-wrap">
         <input id="tel" type="text" name="" class="form-control">
       </div>
     </div>
     <div class="form-group">
       <div class="form-label"> </div>
       <div class="form-control-wrap">
         <a href="javascript:;" class="save-btn">提交</a>
       </div>
     </div>
  </div>
</div>
<!-- Save for Web Slices (15.jpg) -->
<table id="__01" width="100%" height="" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>
      <img src="images/16_01.jpg?r=123" width="100%" height="" alt=""></td>
  </tr>
  <tr class="time">
    <td>
      <img src="images/16_02.jpg?r=123" width="100%" height="" alt=""></td>
  </tr>
  <tr class="rule">
    <td>
      <img src="images/16_03.jpg?r=123" width="100%" height="" alt=""></td>
  </tr>
  <tr class="prize">
    <td>
      <img src="images/16_04.jpg?r=123" width="100%" height="" alt=""></td>
  </tr>
  <tr class="rank">
    <td>
      <img src="images/16_05.jpg?r=123" width="100%" height="" alt=""></td>
  </tr>
  <tr>
    <td>
      <img src="images/16_06.jpg?r=123" width="100%" height="" alt=""></td>
  </tr>
</table>
<a href="javascript:;" class="footer-wrap open-app">
    <div class="footer" data-bury-point="openApp">
        <img src="http://share.axingxing.com/allstar/images/logo.jpg" alt="" class="logo">
        <span class="xingxing">猩猩电竞</span>
        <!--<span class="unlock">用话题圈解锁陌生人聊天</span>-->
        <span href="javascript:;" class="open-btn fr">立即打开</span>
    </div>
</a>

<!-- End Save for Web Slices -->
<script src="https://download.91playmate.cn/web/allstar/js/libs/zepto.js?v=4.032"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js" type="text/javascript"></script>
<script src="https://download.91playmate.cn/web/allstar/js/common.js" type="text/javascript"></script>
<!-- <script src="//cdn.jsdelivr.net/npm/eruda"></script>
<script>eruda.init();</script> -->

<script type="text/javascript">
if(!mutil.isXX){
  $('.footer-wrap').show();
  $('table').css({marginBottom: '.92rem'});
  $('.apply-btn').addClass('open-app');
}else{
  $('.apply-btn').on('click', function(){
    $('.apply-dialog').show();
    $('body, html').addClass('dialog-open');
  });
}

var baseUrl = 'https://php.axingxing.com/h5/chiji/api/v1';
var game_id = '15262776155792150';
if(mutil.getQueryString('xingxingTag') == 2){
  // baseUrl = 'https://wx.axingxing.com/h5/chiji';
  baseUrl = 'http://223.203.221.49:86/api/v1';
  game_id = '15258331729598406';
}
// alert(444)
getUserInfo();

// $('#uid').val('1000056');
// $('#nick_name').val('用户56');
// getData('1019003');
// $('#uid').val('1000485');
// $('#nick_name').val('用485');
// $('#tel').val('13582104444');
// getData('1000485');


var shareInfo = {
  title: '猩猩电竞',
  desc: '猩球大战杯—自定义模式娱乐赛，开赛啦！位置有限，速来报名！',
  link: window.location.href,
  imgUrl: 'http://share.axingxing.com/allstar/images/logo.jpg',
  type: '',
  dataUrl:'',
};



$('.tip').on('click', function(){
  $('.tip').hide();
});

$('.apply-dialog').on('click', function(e){
  var $elem = $(e.target);
  if($elem.hasClass('apply-dialog') || $elem.hasClass('close')){
    closeDialog();
  }
});

$('body').on('click', '.checkbox', function(){
  var $elem = $(this);
  var index = $elem.data('index');
  // setData(index);
  if($elem.hasClass('disabled')){
    showTip('您已报名不可取消');
    return;
  }
  if($elem.hasClass('checked')){
    $elem.removeClass('checked');
  }else{
    $elem.addClass('checked');
  }
});

$('.save-btn').on('click', function(){
  saveData();

})

$('.time-btn').on('click', function(){
  show('.time');
});

$('.rule-btn').on('click', function(){
  show('.rule');
});

$('.prize-btn').on('click', function(){
  show('.prize');
});
$('.rank-btn').on('click', function(){
  show('.rank');
});

function show(showElem){
  $('.time').hide();
  $('.rule').hide();
  $('.prize').hide();
  $('.rank').hide();

  $(showElem).show();
}

function closeDialog(){
  $('.apply-dialog').hide();
  $('body, html').removeClass('dialog-open');
}


function showTip(text){
  $('.tip').show();
  $('.tip-text').html(text);
}

function getUserInfo(){
  mutil.myWebBirdgeClient({
    url: '/api/v1/user/index',
    type: 'post',
    data: {
      
    },
  }, function(res){
    const resData = res.data;

    if(resData.code == 1){
      var userInfo = resData.data.user;

      $('#uid').val(userInfo.xingxingid);
      $('#nick_name').val(userInfo.nick_name);

      getData(userInfo.xingxingid);

    }
  });
}

function getData(user_id){
  var url = baseUrl + '/api/sports/get_games';

  $.ajax({
    url: url,
    data: {
      user_id: user_id,
      game_id: game_id,
    },
    header: {
      withCrediental: true,
    },
    success: function(res){
      if(res.code == 200){
        var changciHtml = '';
        res.info.field_list.forEach(function(item, index){
          if(item.staus == 0){
            changciHtml += '<span class="checkbox disabled checked" data-field_number="'+ item.id +'">'+ item.field_title +'</span>';
            // $('.checkbox').eq(index).addClass('disabled checked');
          }else{
            changciHtml += '<span class="checkbox" data-field_number="'+ item.id +'">'+ item.field_title +'</span>';
          }
          // $('.checkbox').eq(index).data('field_number', item.id);
        });
        $('#changci-box').html(changciHtml);



        // $('#uid').val(res.info.uid);
        // $('#nick_name').val(res.info.nick_name);
        // $('#xingxingid').val(res.info.xingxingid);
        $('#steamid').val(res.info.steam_id);
        $('#weixin_qq').val(res.info.weixin_qq);
        $('#tel').val(res.info.tel);
      }
    },
    error: function(){

    }
  });
}

function saveData(){
  var url = baseUrl + '/api/sports/signup_activity';
  var xingxingid = $('#uid').val();
  var nick_name = $('#nick_name').val(); 
  var activity_id = game_id;
  // var xingxingid = $('#xingxingid').val(); 
  var steamid = $('#steamid').val(); 
  var weixin_qq = $('#weixin_qq').val(); 
  var tel = $('#tel').val(); 

  steamid = $.trim(steamid);
  weixin_qq = $.trim(weixin_qq);

  var $checkedElem = $('.checkbox.checked:not(.disabled)');
  var field_numbers = [];
  $checkedElem.each(function(){
    var id = $(this).data('field_number');
    if(id){
      field_numbers.push(id);
    }
  });
  var field_number = field_numbers.join(','); 

  if(!steamid){
    showTip('请输入游戏ID');
    return ;
  }

  if(!field_numbers.length){
    if($('.checkbox.checked').length == 3){
      showTip('您已成功报名全部场次');
      return ;
    }else{
      showTip('请选择未报名场次');
      return ;
    }
  }
  if(!/^\d+$/.test(weixin_qq)){
    showTip('请输入合法QQ号');
    return ;
  }

  if(!/^[1][0-9]{10}$/.test(tel)){
    showTip('请输入合法手机号');
    return ;
  }


  $.ajax({
    url: url,
    data: {
      xingxingid: xingxingid,
      nick_name: nick_name,
      activity_id: activity_id,
      steamid: steamid,
      field_number: field_number,
      weixin_qq: weixin_qq,
      tel: tel,
    },
    header: {
      withCrediental: true,
    },
    success: function(res){
      if(res.code == 200){
        closeDialog();
        showTip(res.msg)
        $('.checkbox.checked:not(.disabled)').each(function(item){
          $(this).addClass('disabled');
        });
      }else{
        showTip(res.msg)
      }
    },
    error: function(){

    }
  });
}

</script>
<script src="https://s13.cnzz.com/z_stat.php?id=1273647874&web_id=1273647874" language="JavaScript"></script>
</body>
</html>
